<?php

use think\exception\HttpResponseException;


function throw_validate_error($condition, $message, $code = 0)
{
    if ($condition) {
        $result = [
            'msg' => $message,
            'code' => $code,
            'time' => time(),
            'data' => null
        ];
        $header['statuscode'] = 200;
        $response = \think\Response::create($result, 'json', 200)->header($header);
        throw new think\exception\HttpResponseException($response);
    }
}

